import request from '@/utils/request';
import type { LocationQuery, LocationForm, LocationVo } from './types';

// 查询设备位置列表
export function listLocation(query: LocationQuery) {
  return request({
    url: '/vending/location/page',
    method: 'get',
    params: query
  });
}

// 获取设备位置详细信息
export function getLocation(id: number) {
  return request({
    url: '/vending/location/' + id,
    method: 'get'
  });
}

// 新增设备位置
export function addLocation(data: LocationForm) {
  return request({
    url: '/vending/location',
    method: 'post',
    data: data
  });
}

// 修改设备位置
export function updateLocation(data: LocationForm) {
  return request({
    url: '/vending/location',
    method: 'put',
    data: data
  });
}

// 删除设备位置
export function delLocation(id: number) {
  return request({
    url: '/vending/location/' + id,
    method: 'delete'
  });
}

// 批量删除设备位置
export function delBatchLocation(ids: number[]) {
  return request({
    url: '/vending/location/batch/' + ids,
    method: 'delete'
  });
}
